package com.atguigu.yygh.order.api;

import com.atguigu.yygh.commom.result.Result;
import com.atguigu.yygh.order.service.OrderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mengWu
 * @Date 2021年06月06日 12:50
 */

@RestController
@RequestMapping("/api/order/orderInfo")
public class OrderApiController {
    @Autowired
    private OrderService orderService;

    //生成挂号订单,根据排班id和就诊人id生成，订单
    @ApiOperation("生成挂号订单")
    @PostMapping("auth/submitOrder/{scheduleId}/{patientId}")
    public Result saveOrder(@PathVariable("scheduleId") String scheduleId,
                            @PathVariable("patientId") long patientId){
        Long orderId = orderService.saveOrder(scheduleId, patientId);

        return Result.ok(orderId);
    }
}
